package com.riant.code;

public class LNode {
    public int value;
    public LNode next;

    public LNode() {
    }

    public LNode(int value, LNode next) {
        this.value = value;
        this.next = next;
    }

    void printValue() {
        //System.out.print(value);
        LNode p = this.next;

        while (null != p) {
            //System.out.print("-->" + p.value);
            System.out.print(p.value + "-->");
            p = p.next;
        }
        System.out.println();
    }

    void add(LNode lnode) {
        if (this.next == null) {
            this.next = lnode;
            return;
        }
        LNode cur = this.next;
        while (cur.next != null) {
            cur = cur.next;
        }
        cur.next = lnode;
    }
}
